import request from "@/utils/request";

// 查询物资分类列表
export function getTypeList(_data) {
  return request({
    url: "/api/material/ofMaterialType/getList",
    method: "get",
    data: _data,
  });
}

// 查询物资分类信息
export function getInfo(id) {
  return request({
    url: "/api/material/ofMaterialType/" + (!!id ? id : 0),
    method: "GET",
  });
}

// 新增物资分类
export function addType(_data) {
  return request({
    url: "/api/material/ofMaterialType",
    method: "post",
    data: _data,
  });
}

// 修改物资分类
export function updateType(_data, id) {
  return request({
    url: "/api/material/ofMaterialType/" + id,
    method: "put",
    data: _data,
  });
}

// 删除物资分类
export function delType(id) {
  return request({
    url: "/api/material/ofMaterialType/" + id,
    method: "delete",
  });
}

// 查询物资分类树
export function getTypeListTree(parentId) {
  return request({
    url:
      "/api/material/ofMaterialType/getListTree/" + (!!parentId ? parentId : 0),
    method: "GET",
  });
}
